using System;
using UnityEngine;

namespace FW
{
    public enum EPLAYERSTATE
    {
        IDLE,
        RUN,
        JUMP,
        FALL,
        ATK,
        SKILL,
        BEHIT,
        DIE,
        roll,
        NONE = 1000
    }

    public enum EInputState
    {
        Walk,
        Run,
        Jump,
        Skill,
        Reborn,
        Roll,
        JumpAttack,
        Die,
        LoadOk,
        Interacive,
    }

    public partial class Player
    {

        public Vector3 deltaPosition = Vector3.zero;
        public EPLAYERSTATE state;
        private void MoveAndJump(GameObject model,KeyMouseInput keyInput)
        {
            if (deltaPosition != Vector3.zero)
            {
                transform.position += deltaPosition;
                deltaPosition = Vector3.zero;   
            }
            if (keyInput.isBanMove) return;
            if (!keyInput.isinputEnabled  && keyInput._isJumping) return;
            if ((keyInput.targetDup !=0f || keyInput.targetDright!=0f) && state != EPLAYERSTATE.ATK)
            {
                var speed = (keyInput.isRun == 2f ? _runSpeed : _walkSpeed);
                transform.position += model.transform.forward.normalized * Time.fixedDeltaTime * speed;

            }
            Vy += _gravity * Time.fixedDeltaTime;
            if(transform.position.y +Vy * Time.fixedDeltaTime <= groundY && onGroundSensor.isOnGround()) //这里加多一个条件 ，射线地面检测 <=groundY && 射线检测为空中  ===>就说明要掉下去 
            {
                Vy = 0f;
            }
            transform.position +=Vector3.up * (Vy) * Time.fixedDeltaTime;

        }
    }
}